class Log{
    constructor(){
        this.logs = [];
        this.infoLevel = "info";
        this.errorLevel = "error";
        this.warnLevel = "warn";
    }
    append = (type , content) => {
        if (this.logs.length >= 50){
            this.logs.shift();
        }
        this.logs.unshift({
            type,
            content,
            time: new Date().getTime()
        });
    }
    info = (content) => {
        this.append(this.infoLevel , content);
    }
    error = (content) => {
        this.append(this.errorLevel , content);
    }
    warn = (content) => {
        this.append(this.warnLevel , content);
    }
    getLogs = () => {
        return this.logs;
    }
}


const log = new Log();
export {log};
